// components/home/goods.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    imgsrc: {
      type: String,
      value: '../../images/home/goods1.png'
    },
    content: {
      type: String,
      value: 'MAGIC DRAGON魔杰龙轻柔倍适纸尿裤'
    },
    price: {
      type: Number,
      value: 138
    },
    original_price: {
      type: Number,
      value: 152
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    imgPath: '/images',
    priceStr: '',
    priceoldStr:''
  },

  observers: {
    "price": function (price) {
      this.setData({
        priceStr: Number(price).toFixed(2),
      })
    },
    "original_price": function (original_price) {
      this.setData({
        priceoldStr: Number(original_price).toFixed(2),
      })
    },
     "imgsrc": function (imgsrc) {
      
     }
    
  },

  /**
   * 组件的方法列表
   */
  methods: {

  },
  lifetimes: {
    attached() {
      const util = require("../../utils/util")
      this.setData({
        imgPath: util.getImgPath(),
      })

      // this.setData({
      //   imgSrc:this.data.imgPath+"/icons/goods1.png"
      // })
      
      //console.log('sssss:',imgSrc);

    }
  }
})